package com.yequan.bird;

/**
 * @author yequan
 * @date 2021/08/07 18:55
 **/
public class TuoNiaoBird2<T> implements Bird, DownEgg,CryBird {


    private CryEnable cryEnable;
    private DownEgg downEgg;
    private CryBird cryBird;

    public TuoNiaoBird2() {
        this.downEgg = new DownEggPower();
    }

    @Override
    public String name() {
        return "鸵鸟";
    }

    @Override
    public void downEgg(){
        downEgg.downEgg();
    }

    public void setCryBird(CryBird cryBird) {
        this.cryBird = cryBird;
    }

    public void setCryEnable(CryEnable cryEnable) {
        this.cryEnable = cryEnable;
    }

    @Override
    public void cry() {
        if (cryEnable.cryEnable()){
            cryBird.cry();
        }
    }
}
